package cn.edu.ctbu.datajpa01.service;

import cn.edu.ctbu.datajpa01.domain.Student;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {


 /**
  * 读取所有学生数据
  * @return
  */
 List<Student> findAll();

 /**
  * 只分页的查询
  * @param pageable
  * @return
  */
 Page<Student> findAll(Pageable pageable);
 public Page<Student> findAll(Example<Student> student, Pageable pageable );


 /**
  * 按id进行查询
  * @param id 主键，整数
  * @return
  */
 Student findById(Integer id);

 /**
  * 按名字进行查询,like操作
  * @param name
  * @return
  */
 List<Student> findByName(String name);

 /**
  * 按名字和密码查询
  *
  * @param name
  * @param password
  * @return
  */
 public List<Student> findByNameAndPassword(String name,String password);
 Student insert(Student student);

 Student update(Student student);
 void delete(Integer id);
 void delete2(Integer id);

}
